<div class="modal-dialog">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			<h4 class="modal-title" id="myModalLabel"><b>导入团队数据</b></h4>
		</div>
		<div class="modal-body form-horizontal">
			<form name="form1" action="{:U("chrm/count/team")}" method="post" enctype="multipart/form-data">
				<p class="form-title">导入团队数据</p>
				<div class="form-group">
					<label for="name" class="col-sm-3 control-label">选择文件</label>
					<div class="col-sm-9">
						<input class="form-control" type="file" name="excel" onchange="getPhotoSize(this)" />
					</div>
				</div>
				<div class="form-group">
					<label for="name" class="col-sm-3 control-label">文件要求:</label>
					<div class="col-sm-9">
						<p>&nbsp;</p>
						<div>导入excel文件一定要严格按照规定的格式</div>
						<div>允许类型：'xls'(文件总大小不能超过20MB)</div>
					</div>
				</div>
				<div class="modal-footer">
					<input name="submit" class="btn btn-primary" type="submit" value="提交"/>&nbsp;&nbsp;&nbsp;&nbsp;
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				</div>
			</form>
		</div>
	</div>
</div>
<script>
	//判断文件大小
	function getPhotoSize(obj) {
		photoExt = obj.value.substr(obj.value.lastIndexOf(".")).toLowerCase(); //获得文件后缀名
//		alert(photoExt);
		if (photoExt != '.xlsx' or photoExt != '.xls') {
			alert("请上传后缀名为xlsx或xls的EXCEL文件!");
			return false;
		}
		var fileSize = 0;
		var isIE = /msie/i.test(navigator.userAgent) && !window.opera;
		if (isIE && !obj.files) {
			var filePath = obj.value;
			var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
			var file = fileSystem.GetFile(filePath);
			fileSize = file.Size;
		} else {
			fileSize = obj.files[0].size;
		}
		fileSize = Math.round(fileSize / 1024 * 100) / 100; //单位为KB
		if (fileSize >= 20480) {
			alert("文件不得大于20M，请重新上传!");
			return false;
		}
	}
</script>